﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NMemcachedConfiguration"
    targetNamespace="http://memcached.protectedvoid.com/2011/06/configuration"
    elementFormDefault="qualified"
    xmlns="http://memcached.protectedvoid.com/2011/06/configuration"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:element name="nmemcached.client" type="nmemcached.client" />
  <xs:complexType name="nmemcached.client">
    <xs:sequence>
      <xs:element name="connectionProvider" type="connectionProvider" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="useUTC" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>
  <xs:complexType name="connectionProvider">
    <xs:sequence>
      <xs:element name="add" type="add" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="hashAlgorithm" type="hashAlgorithms" default="fnv1a32" use="optional" />
  </xs:complexType>
  <xs:complexType name="add">
    <xs:attribute name="server" type="xs:string" use="required" />
    <xs:attribute name="port" type="ipPortRange" use="optional" default="11211" />
    <xs:attribute name="protocol" type="protocols" use="optional" default="text" />
    <xs:attribute name="transport" type="transports" use="optional" default="tcp" />
    <xs:attribute name="useCompression" type="xs:boolean" use="optional" default="false" />
    <xs:attribute name="compressionAlgorithm" type="compressionAlgorithms" use="optional" default="GZip" />
    <xs:attribute name="payloadEncoding" type="textEncoding" use="optional" default="UTF8" />
    <xs:attribute name="protocolEncoding" type="textEncoding" use="optional" default="UTF8" />
    <xs:attribute name="sendTimeout" type="xs:integer" use="optional" default="5000" />
    <xs:attribute name="receiveTimeout" type="xs:integer" use="optional" default="5000" />
  </xs:complexType>
  <xs:simpleType name="ipPortRange">
    <xs:restriction base="xs:int">
      <xs:minInclusive value="1" />
      <xs:maxInclusive value="65535" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="protocols">
    <xs:restriction base="xs:string">
      <xs:enumeration value="text" />
      <xs:enumeration value="binary" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="transports">
    <xs:restriction base="xs:string">
      <xs:enumeration value="tcp" />
      <xs:enumeration value="connectionOriented" />
      <xs:enumeration value="udp" />
      <xs:enumeration value="connectionless" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="hashAlgorithms">
    <xs:restriction base="xs:string">
      <xs:enumeration value="fnv32" />
      <xs:enumeration value="fnv1a32" />
      <xs:enumeration value="fnv64" />
      <xs:enumeration value="fnv1a64" />
      <xs:enumeration value="md5" />
      <xs:enumeration value="sha1" />
      <xs:enumeration value="sha256" />
      <xs:enumeration value="sha384" />
      <xs:enumeration value="sha512" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="compressionAlgorithms">
    <xs:restriction base="xs:string">
      <xs:enumeration value="GZip" />
      <xs:enumeration value="Deflate" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="textEncoding">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ASCII" />
      <xs:enumeration value="BigEndianUnicode" />
      <xs:enumeration value="Unicode" />
      <xs:enumeration value="UTF32" />
      <xs:enumeration value="UTF7" />
      <xs:enumeration value="UTF8" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>